/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.shooter;

import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.math.Intersector;
import com.badlogic.gdx.math.Rectangle;

/**
 *
 * @author Unni Vemanchery Mana
 */
public class CollisionManager {
    
 private static boolean collided = false;
 
 private static boolean baddiesCollided = false;
 
 public static boolean checkSimpleColision(int y1, int playerY, int x1, int playerX, Player player){
    Texture texture = player.getTexture();
    int h = texture.getHeight();    
    int w = texture.getWidth();
    if(y1 <= 0){ 
        x1 = 0;
    }
   // System.out.println("y1 "+y1+ "playerY " + playerY +" playerX "+ playerX+" x1 " + x1);
    if(y1 <= playerY){
       if(playerX == x1) {
          System.out.println(" hit...."); 
          collided = true;
          return true;
       }
    }
    else collided = false;
    return collided;
 }
 
 public static boolean checkSimpleCollision(int x, int y, int playerX, int playerY, Texture texture){
    if(y <= 0){ 
       x = 0;
    }
        if(playerX >=x && playerX<= (x + texture.getWidth())){
            baddiesCollided = true;
            System.out.println(" ...... bullet collided with enemy.....");
          return true;
        }
    else baddiesCollided = false;
    return baddiesCollided;
 }
 
 public static boolean checkSimpleCollison(Rectangle r1, Rectangle r2) {
   return Intersector.overlapRectangles(r1, r2);  
 }
 
 public boolean checkSimpleCollision(int playerX, int playerY, int x, int y ){
    System.out.println("playerX " + playerX); 
    if(playerX>=x){
       if(playerY>=y){
          return true; 
       }
    }        
    return false;
 }
 
}
